package utils;

import java.nio.charset.Charset;
import java.util.Iterator;
import java.util.Set;
import java.util.SortedMap;

public class Encoding {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		SortedMap<String, Charset> charsetMap = Charset.availableCharsets();
	      Set<String> llaves = charsetMap.keySet();
	      System.out.println("Canonical name, Display name,"
	         +" Can encode, Aliases");
	      Iterator<String> i = llaves.iterator();
	      while (i.hasNext()) {
	         String n = i.next();
	         Charset e = (Charset) charsetMap.get(n);
	         String d = e.displayName();
	         boolean c = e.canEncode();
	         System.out.print(n+", "+d+", "+c);
	         Set<String> s = e.aliases();
	         Iterator<String> j = s.iterator();
	         while (j.hasNext()) {
	            String a = j.next();         
	            System.out.print(", "+a);
	         }
	         System.out.println("");
	      }

	}

}
